python solution to lines and circles